import 'package:location/types.dart';
import 'location_platform_interface.dart';

class Location {

  /// 修改定位参数
  Future<bool?> changeSettings() {
    return LocationPlatform.instance.changeSettings();
  }

  /// 检查后台定位服务是否开启
  Future<bool> isBackgroundModeEnabled() {
    return LocationPlatform.instance.isBackgroundModeEnabled();
  }

  /// 开启后台定位
  Future<bool> enableBackgroundMode({bool? enable}) {
    return LocationPlatform.instance.enableBackgroundMode(enable: enable);
  }

  ///获取位置信息
  Future<LocationData> getLocation() {
    return LocationPlatform.instance.getLocation();
  }

  ///获取地址信息
  Future<GeoAddress> getGeoAddress() {
    return LocationPlatform.instance.getGeoAddress();
  }

  /// 检查权限
  Future<PermissionStatus> hasPermission() {
    return LocationPlatform.instance.hasPermission();
  }

  /// 申请权限
  Future<PermissionStatus> requestPermission() {
    return LocationPlatform.instance.requestPermission();
  }

  /// 检查服务是否开启
  Future<bool> serviceEnabled() {
    return LocationPlatform.instance.serviceEnabled();
  }

  /// 开启服务
  Future<bool> requestService() {
    return LocationPlatform.instance.requestService();
  }

  /// 获取位置信息流
  Stream<LocationData> get onLocationChanged {
    return LocationPlatform.instance.onLocationChanged;
  }

}
